package com.feifei.springcloud.controller;

import com.feifei.springcloud.pojo.Dept;
import com.feifei.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class DeptConsumerController
{
    @Resource
    private DeptClientService deptClientService = null;

    @RequestMapping("/consumer/dept/add")
    public boolean add(Dept dept){
        return this.deptClientService.add(dept);
    }
    @RequestMapping("/consumer/dept/get/{id}")
    public Dept getDept(@PathVariable("id") Long id){
        return this.deptClientService.queryById(id);
    }
    @RequestMapping("/consumer/dept/list")
    public List<Dept> getAll(){
        return this.deptClientService.queryAll();
    }
}
